<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function add(a, b) {
        let pos = 0
        let res = ''

        while (a.length > pos || b.length > pos) {
          const carry = res.length - pos++
          res = ~~a[a.length - pos] + ~~b[b.length - pos] + carry + res.substring(carry)
        }

        console.log(res)
      }

      add('999', '26661')
    </script>
  </body>
</html>
